#include "LCDDisplay.h"

namespace GASPUMP
{

LCDDisplay::LCDDisplay(void)
{
}

void LCDDisplay::ON(){lcd_state=Ready;}

void LCDDisplay::OFF(){lcd_state=Not_Ready;}

cardreader LCDDisplay:: LCD_operating_Menu( Controller* ctrlr)
{	
	int m_userselect;
	long m_cardread;
	int pin_zip;
	//ctrlr = new GASPUMP::Controller;
	
	cout << "Please choose your method of payment" << endl;
	cout << " Select 1 for Credit \n Select 2 for Debit \n Select 3 to pay by Cash." << endl;
	cin >> m_userselect;		

	bool terminate = false;

	do
	{
		switch( m_userselect )
	{			
				
		case 1: 
		{
			cout << "Please insert card: " ;
			cin >> m_cardread; 
			cout << "Enter your ZipCode code: ";
			cin >> pin_zip; 
			crd = cardreader(m_cardread,CREDIT,pin_zip); 
			return crd;
			break;
		}
		case 2: 
		{
			cout << "Please insert card: " ;
			cin >> m_cardread; 
			cout << "Enter your PIN code: ";
			cin >> pin_zip; 
			crd=cardreader(m_cardread,DEBIT,pin_zip);
			return crd;
			break;			
		}
		case 3: 
		{
			cout<<"go to the cashier Please"<<endl;
			return crd;
			break;
		}
		case 8877: ctrlr->m_opmode = false;
			return crd;
			break;
		default:
			LCDError broke ("This is an unsupported menu option\n Please try again...");
			throw broke;			
			break;			
		}
	}while( terminate );
}

int LCDDisplay::LCD_Select_Grade()
{
	int choice = 0;

	cout<<"Select type of Grade"<<endl;
	cout<<"Please Select 0 for REGULAR  MIDGRADE = 1, PREMIUM = 2" << endl;


				
	cin>>choice;
	return choice;
	//Fuelsel.fuelGrade(choice);
}

void LCDDisplay::LCD_PumpFuel()
{
	cout<<"Fuelling............"<<endl;
}

void LCDDisplay:: LCD_Maintain_Menu()
	{
		cout<<"Under Maintanance"<<endl;
	}

void LCDDisplay:: LCD_RrSup_Menu()
	{
		cout<<"resuppling"<<endl;
	}
	
LCDDisplay::~LCDDisplay(void)
{
}

LCDError::LCDError(std::string errnum)
{
	lcd_what = errnum;
}

std::string LCDError::getLCDError()
{
	return lcd_what;
}

LCDError::~LCDError()
{
}

}